/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tomasio.projects.welcome.model;

import com.tomasio.projects.welcome.dto.CameraDTO;

/**
 *
 * @author Install
 */
public class Camera {

    private Long id;
    private String ip;
    private String mac;
    private String hostname;
    private String legenda;

    public Camera() {
    }

    public Camera(CameraDTO dto) {
        if (dto != null) {
            id = dto.getId();
            ip = dto.getIp();
            mac = dto.getMac();
            hostname = dto.getHostname();
            legenda = dto.getLegenda();
        }
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getLegenda() {
        return legenda;
    }

    public void setLegenda(String legenda) {
        this.legenda = legenda;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Camera)) {
            return false;
        }
        Camera other = (Camera) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.getId().equals(other.getId()))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Camera[id=" + getId() + "]";
    }

    public CameraDTO createDTO() {
        CameraDTO dto = new CameraDTO();
        dto.setId(id);
        dto.setHostname(hostname);
        dto.setIp(ip);
        dto.setLegenda(legenda);
        dto.setMac(mac);
        return dto;
    }
}
